find and differentiate words in javascript